var t = getApp();

Page({
    data: {
        status: !1,
        calsst: "z",
        id: "",
        share: [],
        setting: [],
        language: ""
    },
    onLoad: function(t) {
        t.id && (this.setData({
            id: t.id
        }), this.getData());
        var a = wx.getStorageSync("langIndex");
        this.setData({
            language: a.en
        });
    },
    tapClass: function(t) {
        var a = t.currentTarget.dataset.ind;
        console.log(a), "z" == a ? this.setData({
            calsst: a,
            topBanner: this.data.info.banner
        }) : (this.data.navinfo = [], this.setData({
            navinfo: this.data.info.other_rank_list[a],
            calsst: a,
            topBanner: this.data.info.other_rank_list[a].banner
        }));
    },
    goDetail: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + a
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        var t = this.data.setting.share_logo, a = this.data.setting.share_title, n = this.data.setting.title;
        return {
            title: a || n,
            path: "/packageH/shopRanking/shopRanking/index?id=" + this.data.id,
            imageUrl: t || ""
        };
    },
    getData: function() {
        var a = this;
        wx.showLoading({
            title: "加载中"
        });
        var n = this, i = t.getNetAddresss("plugin.goods-ranking.api.index.rank-info");
        t._postNetWork({
            url: i,
            data: {
                id: n.data.id
            },
            success: function(t) {
                var i = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == i.result ? (n.setData({
                    info: i.data,
                    status: i.data.has_category,
                    setting: i.data.setting,
                    topBanner: i.data.banner
                }), console.log(n.data.status), "1" == i.data.has_category && a.setData({
                    calsst: "z",
                    navinfo: i.data.other_rank_list[0]
                }), wx.setNavigationBarTitle({
                    title: i.data.name
                })) : wx.showToast({
                    title: i.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    }
});